import gensim

from aaaaaa import fileConfig as Conf
from aaaaaa.classification import ModelManagement
from aaaaaa.data import dataProcess
from aaaaaa.vector import Vectorization

s = " 这蛋糕真他妈的好吃啊 卧槽，我太他妈好吃了 )/"
model_path = "testModule.model"

d = dataProcess()
resultDataStream = dataProcess.dataLoadToList(Conf.train_file_path)
cutSentence = d.sentenceCut(s, Conf.stop_file_path)
vector = Vectorization()
vectorSentence = vector.vectorizationWithModelOnSentence(cutSentence,model_path)
#print(vectorSentence)
modelM = ModelManagement()
predict_data = [vectorSentence]
model_conf = {"model_name": "SVM", "proportion": 0.3}
model = gensim.models.doc2vec.Doc2Vec.load(model_path)
result_vector_train_list = [model.docvecs[i] for i in range(len(model.docvecs))]
result = modelM.modelPredict(predict_data=predict_data,
                    train_data=result_vector_train_list,
                    tag=resultDataStream[1],
                    config=model_conf,
                    if_save=False)

print(result[0])
